/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dropclient;

import java.io.File;

/**
 *
 * @author Pudy
 */
class FileDescription {
    private String filename;
    private String checksum;
    private long size;
    private long datemodified;
    private boolean isDeleted;

    public FileDescription(File f){
        filename = f.getName();
        checksum = "";
        size = f.length();
        datemodified = f.lastModified();
        isDeleted = false;
    }

    public boolean getIsDeleted() {
        return isDeleted;
    }

    public void setDeleted(boolean val) {
        isDeleted = val;
    }

    public FileDescription(String msg) {
        String[] tokens = msg.split(",");
        filename = tokens[0];
        checksum = tokens[1];
        size = Long.valueOf(tokens[2]);
        datemodified = Long.valueOf(tokens[3]);
        if (tokens.length == 5) {
            isDeleted = true;
        } else {
            isDeleted = false;
        }
    }

    public void setFilename(String fname) {
        filename = fname;
    }

    public void setChecksum(String fcs) {
        checksum = fcs;
    }

    public void setSize(long fsize) {
        size = fsize;
    }

    public void setDatemodified(long fdate) {
        datemodified = fdate;
    }

    public String getFilename() {
        return this.filename;
    }

    public String getChecksum() {
        return this.checksum;
    }

    public long getSize() {
        return this.size;
    }

    public long getDatemodified() {
        return this.datemodified;
    }
}
